package test.excelHttpsample;

import java.util.LinkedList;
import java.util.List;

import org.apache.jmeter.config.Argument;
import org.apache.jmeter.config.Arguments;
import org.apache.jmeter.protocol.http.util.HTTPArgument;
import org.apache.jmeter.util.JMeterUtils;
import org.apache.oro.text.MalformedCachePatternException;
import org.apache.oro.text.PatternCacheLRU;
import org.apache.oro.text.regex.MatchResult;
import org.apache.oro.text.regex.Pattern;
import org.apache.oro.text.regex.PatternMatcherInput;
import org.apache.oro.text.regex.Perl5Compiler;
import org.apache.oro.text.regex.Perl5Matcher;

import test.ExcelUtil;

public class Debug {
	
	
	
	public static void process(String textToParse,String varName,String regexp) {

        Perl5Matcher matcher = new Perl5Matcher();
        PatternMatcherInput input = new PatternMatcherInput(textToParse);

        PatternCacheLRU pcLRU = new PatternCacheLRU();
        Pattern pattern;
        try {
            pattern = pcLRU.getPattern(regexp, Perl5Compiler.READ_ONLY_MASK);
        } catch (MalformedCachePatternException e) {
            return ;
        }
        List<MatchResult> matches = new LinkedList<>();
        while (matcher.contains(input, pattern)) {
            matches.add(matcher.getMatch());
        }
       System.out.println(textToParse+":\n"+varName+":"+matches.get(0).group(1));

    }
	public static void main(String[] args)throws Exception{
//		Arguments arguments = new Arguments();
//		HTTPArgument argument =new HTTPArgument("", "bb",	false);
//		Arguments arguments2 = new Arguments();
//		Argument argument2 =new Argument("aa", "bb", "","dd");
//		arguments.addArgument(argument);
//		arguments.addArgument(argument2);
//		System.out.println(arguments);		
//		System.out.println(Integer.valueOf("1"));
//		
////		String refName = "aa";
////		int mathcNumber = 1;
////		Perl5Matcher matcher=JMeterUtils.getMatcher();
////		String regex= "www.(.+?)";
////		Pattern pattern = JMeterUtils.getPatternCache().getPattern(regex, Perl5Compiler.READ_ONLY_MASK);
////		List<MatchResult> matches=
////				
//				process("www.baidu.com,www.sudo.com", "aa", "www.(.+?).com");
//			//System.out.println(process("www.baidu.com,www.sudo.com"));
//				
		ExcelUtil excelUtil=new ExcelUtil("C:\\Users\\Administrator\\Desktop\\111.xls");
		System.out.println(excelUtil.readRow(0).get(0));
		System.out.println(excelUtil.readRow(0).get(1));
		System.out.println(excelUtil.readRow(0).get(2));
		
		
		
	}
}
